﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FirstFloor.ModernUI.Windows.Controls;
using IsikFx.Project.ClientApp.Helpers;
using IsikFx.Project.CommonTypes.CRUD;
using IsikFx.Project.Utils;

namespace IsikFx.Project.ClientApp.Content
{
    /// <summary>
    /// Interaction logic for ResetGoals.xaml
    /// </summary>
    public partial class ResetGoals : UserControl
    {
        public ResetGoals()
        {
            InitializeComponent();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ModernDialog dialog = new ModernDialog();
            try
            {
                CrudResponseMessage responseMessage = Helper.ResetGoals();

                if (!responseMessage.HasError && responseMessage.Response.AffectedRows > 0)
                {
                    dialog.Content = "Hedefler Başarılı Şekilde Sıfırlandı.";
                    dialog.ShowDialog();
                }
                else if (responseMessage.HasError)
                {
                    dialog.Content = "Hedefler Başarılı Şekilde Sıfırlandı.";
                    dialog.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.HandleException(ex, typeof(ResetGoals));
                dialog.Content = "Hata Hedefler Sıfırlanamadı!";
            }
        }
    }
}
